package com.bjsxt.rmi;

import com.bjsxt.rmi.api.FirstInterface;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

//客户端主方法
public class ClientMainClass {
    public static void main(String[] args) {
        //代理对象的创建
        FirstInterface firstInterface = null;

        try {
            firstInterface= (FirstInterface)Naming.lookup("rmi://localhost:9998/first");
            System.out.println("对象的类型是："+firstInterface.getClass().getName());
            String result= firstInterface.first("今天学习课程");
            System.out.println(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
